<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>账号信息列表</title>
<link rel="stylesheet" href="bootstrap.min.css">
<script type="text/javascript" src="jquery1.71.js"></script>
<script type="text/javascript">
function outhtml(data){
	var htmltxt="";
	for(var i=0;i<data.length;i++){
		htmltxt = htmltxt + "<tr><td>"+data[i].name+"</td><td>"+data[i].site+"</td><td>"+data[i].user+"</td><td>"+data[i].pwd+"</td><td>"+data[i].remark+"</td></tr>";
	}
	return htmltxt;
}
window.onscroll=function(){
		var page=$(".pagenum").val();
		var pagenum = parseInt(page)+2;
		var main = $(".table").height();
		 var top =$(document).scrollTop();
		 var temp =$(document).height()-$(window).height();
		var isSend = Math.abs(top-temp);
		 if(isSend<=20){
			 $.post("ajax.php", { "page": page},
				   function(data){
					$(".pagenum").val(pagenum);
					$(".table tbody").append(outhtml(data));
				 }, "json");
			}
}
$(document).ready(function(){
      
});
</script>
</head>
<body>
<br/>
<center class="toptxt"><a href="add.php"><input class="btn btn-success" value="添加"></a></center><br/>
<input type="hidden" value="2" class="pagenum" />
<table class="table table-striped table-bordered table-condensed">
  <thead>
    <tr>
      <th>名称</th>
      <th>网站</th>
      <th>账号</th>
      <th>密码</th>
      <th>备注</th>
    </tr>
  </thead>
  <tbody>
  <?php
	include('mysql.class.php');
	$mysql = new mysql();
	$arr = $mysql->getAll('select * from info limit 0,20');
	foreach($arr as $v){
  ?>
    <tr>
      <td><?php echo $v['name'];?> </td>
      <td class="wangzhi"><?php echo $v['site'];?></td>
      <td><?php echo $v['user'];?></td>
      <td><?php echo $v['pwd'];?></td>
      <td><?php echo $v['remark'];?></td>
    </tr>
	<?php } ?>
  </tbody>
</table>
	<center> <a><input class="btn btn-success" value="数据真的到尽头了"></a>
	</center><br/>
</body>
</html>
